const path = require('path')

const htmlWebpackPlugins = require('html-webpack-plugin')

module.exports = {
    entry: path.join(__dirname, './src/main.js'),
    output: {
        path: path.join(__dirname, './dist/'),
        filename: 'bundle.js'
    },
    plugins: [
        new htmlWebpackPlugins({
            template: path.join(__dirname, './src/index.html'),
            filename: 'index.html'
        }),
    ],
    module: {
        rules: [{
                test: /\.css$/,
                use: ['style-loader', 'css-loader']
            },
            {
                test: /\.less$/,
                use: ['style-loader', 'css-loader', 'less-loader']
            },
            {
                test: /\.scss$/,
                use: ['style-loader', 'css-loader', 'sass-loader']
            },
            {
                test: /\.jpg|png|gif|bmp$/,
                // use:'url-loader'
                use: 'url-loader?limit=7631&name=[hash:6]-[name].[ext]'
            },
            {
                test: /\.js$/,
                use: 'babel-loader',
                exclude: /node_modules/
            },
            {
                test: /\.vue$/,
                use: 'vue-loader'
            },
            {
                // 处理样式中字体路径问题
                test: /\.ttf|woff|woff2|eot|svg$/,
                use: 'url-loader'
            }
        ]
    },
    resolve:{
        /* alias:{ // 别名
            'vue$':'vue/dist/vue.js'
        } */
    }
}